//
//  XHNetWorking.h
//  HTTPTEST
//
//  Created by edz on 2020/7/3.
//  Copyright © 2020 LI. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "XHError.h"
#import "XHResponse.h"

////! Project version number for XHNetWorking.
//FOUNDATION_EXPORT double XHNetWorkingVersionNumber;
//
////! Project version string for XHNetWorking.
//FOUNDATION_EXPORT const unsigned char XHNetWorkingVersionString[];

NS_ASSUME_NONNULL_BEGIN
#define DefaultInterval 6
typedef NS_ENUM(NSInteger,WebCacheType) {
    WebCacheTypeUseCache,
    WebCacheTypeUseCacheWhenNOData,
    WebCacheTypeNoUseCache,
    WebCacheTypeaddCache,
    WebCacheTypeUseCacheAndUpdate
};
typedef NS_ENUM(NSInteger,RequestType) {
    RequestTypeGET,
    RequestTypePOST,
    RequestTypeDELETE,
    RequestTypePUT
};
typedef void (^HttpCompletedBlock)(XHResponse *response);
@interface XHNetWorking : NSObject
+ (NSURLSessionDataTask *)requestWithPath:(NSString *)path type:(RequestType)rType completed:(HttpCompletedBlock)completeBlock;


+ (NSURLSessionDataTask *)requestWithPath:(NSString *)path type:(RequestType)rType  params:(NSDictionary *)paramsDic  andHttpHeaders:(NSDictionary *)headerDir completed:(HttpCompletedBlock )completeBlock;


+ (NSURLSessionDataTask *)requestWithPath:(NSString *)path type:(RequestType)rType  params:(NSDictionary *)paramsDic andHttpHeaders:(NSDictionary *)headerDir response:(XHResponse *)response  withCacheType:(WebCacheType)cacheType  completed:(HttpCompletedBlock )completeBlock;


+ (NSURLSessionDataTask *)requestWithPath:(NSString *)path type:(RequestType)rType  timeOutInteral:(NSTimeInterval)timeout params:(NSDictionary *)paramsDic andHttpHeaders:(NSDictionary *)headerDir response:(XHResponse *)response  withCacheType:(WebCacheType)cacheType completed:(HttpCompletedBlock )completeBlock;

//ext UnUseKeys

+ (NSURLSessionDataTask *)requestWithPath:(NSString *)path type:(RequestType)rType  params:(NSDictionary *)paramsDic andHttpHeaders:(NSDictionary *)headerDir response:(XHResponse *)response withCacheType:(WebCacheType)cacheType  noverifyKeys:(NSArray *)unusekeys completed:(HttpCompletedBlock )completeBlock;


+ (NSURLSessionDataTask *)requestWithPath:(NSString *)path type:(RequestType)rType  timeOutInteral:(NSTimeInterval)timeout params:(NSDictionary *)paramsDic andHttpHeaders:(NSDictionary *)headerDir response:(XHResponse *)response withCacheType:(WebCacheType)cacheType  noverifyKeys:(NSArray *)unusekeys completed:(HttpCompletedBlock )completeBlock;

@end

NS_ASSUME_NONNULL_END
